Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Struct

KeyValuePair<K, V>

struct KeyValuePair<K, V>

Module: System.Collections
Assembly: System.Runtime.dll
Source file: KeyValuePair.rvn

Inheritance: Object → ValueType → KeyValuePair<K, V>
Implements: EquatableTo<KeyValuePair<K, V>>

A key and value transported together as a deconstructable value.

Parameters

Name Description
Key The key.
Value The associated value.

Remarks

Native development supports construction, copying, getters, initialization-only accessors and deconstruction. Generated equality and hashing use the declared key and value types, including canonical text equality. Unsupported component Object contracts may fault; generic formatting remains unavailable.

Development generic records support generated equality, hashes and the self-equality interface. See the complete pair contracts, including both operators, null/text behavior, component limits and allocation costs. Generic formatting now produces named Key and Value components with quoted text and explicit null. The rebuilt library includes this override; generic value components still box.

Constructors

1 item
KeyValuePair(Key: K, Value: V) A key and value transported together as a deconstructable value.

Properties

2 items
Key: K Gets or initializes the key.
Value: V Gets or initializes the associated value.

Methods

6 items
Deconstruct(Key: out K, Value: out V) -> () Copies the key and value into separate outputs.
Equals(other: KeyValuePair<K, V>) -> bool Compares key and value using their declared types and canonical text equality. Implements EquatableTo<KeyValuePair<K, V>>.Equals
Equals(obj: object?) -> bool Compares a boxed pair of the same closed generic type; null and other types are unequal. Overrides Object.Equals
GetHashCode() -> int Combines component hashes; equal pairs have equal hashes, which are not persistent identifiers. Overrides Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
ToString() -> string No summary available. Overrides Object.ToString

Operators

2 items
Static member: operator ==(left: KeyValuePair<K, V>, right: KeyValuePair<K, V>) -> bool Compares both components using generated equality.
Static member: operator !=(left: KeyValuePair<K, V>, right: KeyValuePair<K, V>) -> bool Negates generated pair equality.